package com.finace.money.presenter;

import com.finace.money.data.bean.AddressBean;
import com.finace.money.data.bean.EmptyBean;
import com.finace.money.net.rto_rxbuild.RxHttpReponseCompat;
import com.finace.money.net.rto_subscriber.ProgressSubcriber;
import com.finace.money.presenter.contract.InformationContract;

import java.io.File;
import java.util.List;

import javax.inject.Inject;

import okhttp3.Response;
import okhttp3.ResponseBody;

/**
 * Created by zhangpeng on 2018/1/26.
 */

public class InformationPresenter extends BasePresenter<InformationContract.IInformationModel, InformationContract.View> {

    @Inject
    public InformationPresenter(InformationContract.IInformationModel iInformationModel, InformationContract.View view) {
        super(iInformationModel, view);
    }

    public void getAddress() {
        mModel.getAddress().compose(RxHttpReponseCompat.<List<AddressBean>>compatResult())
                .subscribe(new ProgressSubcriber<List<AddressBean>>(mContext, mView) {
                    @Override
                    public void onNext(List<AddressBean> addressBeans) {
                        if (hasView()) {
                            mView.showAddress(addressBeans);
                        }
                    }
                });
    }


}
